home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / os2 / splot170.zip / demo / MYLIB.H < prev    next >
Text File  |  1995-01-19  |  2KB  |  118 lines

  1. /* to be included subroutines file mylib.h */
  2. int anvil()
  3.    {
  4.    /* draw a sapphire anvil */
  5.    newpath();
  6.    moveto(0,0);
  7.    rlineto(0,0.5,0.5,0.5,0.5,0,0.5,-0.5,0,-0.5);
  8.    stroke();
  9.    }
  10.  
  11. int screw(double len)
  12.    {
  13.    int i,j;
  14.    /* draw a screw using a loop for */
  15.    /* the threads */
  16.    newpath();
  17.    moveto(0,0);
  18.    rlineto(0.25,0,0,0.25,-0.5,0,0,-0.25);
  19.    closepath();
  20.    moveto(0.15,0);
  21.    rlineto(0,-len,-0.3,0,0,len);
  22.    moveto(-0.15,0);
  23.    j = (int) (len / 0.2);
  24.    for (i=0;i < j;i++)
  25.       {
  26.       rmoveto(0.3,0);
  27.       rlineto(-0.30,-0.20);
  28.       }
  29.    stroke();
  30.    }
  31.  
  32. int heater()
  33.    {
  34.    int i;
  35.    /* draw a heater using a loop */
  36.    /* for the windings */
  37.    double y = 0;
  38.    newpath();
  39.    moveto(0,0);
  40.    for (i=0;i < 5;i++)
  41.       {
  42.       moveto(0.1,y);
  43.       arcn(0,y,0.1,360,0);
  44.       y = y + 0.4;
  45.       }
  46.    stroke();
  47.    }
  48.  
  49. int slit()
  50.    {
  51.    /* draw a spectrometer slit */
  52.    newpath();
  53.    moveto(0,0);
  54.    rlineto(0,1.5,0.25,0,0,-1.25);
  55.    closepath();
  56.    stroke();
  57.    }
  58.  
  59. int driver()
  60.    {
  61.    /* draw long screw drivers */
  62.    newpath();
  63.    moveto(0,0);
  64.    rlineto(0.15,0,0,0.25,0.1,0,0,10.8);
  65.    moveto(0,0);
  66.    rlineto(-0.15,0,0,0.25,-0.1,0,0,10.8);
  67.    stroke();
  68.    }
  69.  
  70. int white_box(double x1,double y1,double x2,double y2)
  71.    { 
  72.    /* draw a white filled box for */
  73.    /* white out purposes. The parametrs */
  74.    /* passed in are the box corners */
  75.    newpath();
  76.    box(x1,y1,x2,y2);
  77.    gsave();
  78.    set(LINECOLOUR,WHITE);
  79.    fill();
  80.    grestore();
  81.    }
  82.  
  83. int lens()
  84.    {
  85.    /* draw a spherical lens using arcs */
  86.    newpath();
  87.    arcn(0,-4,4,110,70);
  88.    arcn(0,3.45,4,290,250);
  89.    closepath();
  90.    stroke();
  91.    }
  92.  
  93. int prism()
  94.    {
  95.    /* draw a prism */
  96.    newpath();
  97.    moveto(0,0.5);
  98.    rlineto(0,-0.5,0.5,0);
  99.    closepath();
  100.    stroke();
  101.    }
  102.  
  103. int tail()
  104.    {
  105.    /* draw the dewar tail */
  106.    set(LINECOLOUR,BLACK);
  107.    moveto(2.44,30);
  108.    lineto(2.44,6.33,7.77,6.33,7.77,30);
  109.    stroke();
  110.    /* draw windows */
  111.    set(LINECOLOUR,BROWN);
  112.    white_box(2.29,12.30,2.59,9.41);
  113.    stroke();
  114.    white_box(7.62,12.30,7.92,9.41);
  115.    stroke();
  116.    }
  117.  
  118.